<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/6/23 16:21
 */

namespace App\Project\Filters;

class HpiFilter extends FilterAbstract
{
    protected function forExtend()
    {
        $map = [
            'diet'                                     => 1,
            'diet.staple'                              => 1,
            'diet.meat'                                => 1,
            'diet.fat'                                 => 1,
            'diet.vegetable'                           => 1,
            'diet.fruit'                               => 1,
            'diet.salt'                                => 1,
            'diet.breakfastAdditional'                 => 1,
            'diet.breakfast'                           => 1,
            'diet.lunchAdditional'                     => 1,
            'diet.lunch'                               => 1,
            'diet.dinnerAdditional'                    => 1,
            'diet.dinner'                              => 1,
            'sport'                                    => 1,
            'sport_strength'                           => 1,
            'sport_time'                               => 1,
//            'thyroid'                                  => 1,    //  甲状腺情况
//            'thyroid.started_at'                       => 1,    //  甲状腺情况 起病日期
//            'thyroid.inducement'                       => 1,    //  甲状腺情况 诱因
//            'thyroid.symptoms'                         => 1,    //  甲状腺情况 起病症状
//            'thyroid.symptoms_remark'                  => 1,    //  甲状腺情况 起病症状 备注
//            'thyroid.examination'                      => 1,    //  甲状腺情况 化验检查
//            'thyroid.examination_remark'               => 1,    //  甲状腺情况 化验检查 备注
//            'thyroid.hyperthyroidism'                  => 1,    //  甲状腺情况 甲亢相关症状
//            'thyroid.hyperthyroidism_remark'           => 1,    //  甲状腺情况 甲亢相关症状 备注
            'adrenal_gland'                            => 1,    //  高血压肾上腺疾病
            'adrenal_gland.started_at'                 => 1,    //  高血压肾上腺疾病 起病日期
            'adrenal_gland.symptoms'                   => 1,    //  高血压肾上腺疾病 起病症状
            'adrenal_gland.symptoms_remark'            => 1,    //  高血压肾上腺疾病 起病症状 备注
            'adrenal_gland.accompanied_symptom'        => 1,    //  高血压肾上腺疾病 伴随症状
            'adrenal_gland.accompanied_symptom_remark' => 1,    //  高血压肾上腺疾病 伴随症状 备注
            'normal.diet'                              => 1,
            'normal.sleep'                             => 1,
            'normal.spirit'                            => 1,
            'normal.emotion'                           => 1,
            'normal.shit.value'                        => 1,
            'normal.shit.frequency'                    => 1,
            'normal.shit.customFrequency'              => 1,
            'normal.shit.remark'                       => 1,
            'normal.pee.frequency'                     => 1,
            'normal.pee.value'                         => 1,
            'normal.pee.remark'                        => 1,
            'normal.pee.difficulty'                    => 1,
            'normal.sweat.situation'                   => 1,
            'normal.sweat.remark'                      => 1,
            'remark'                                   => 1,
        ];

//        $map['thyroid.symptoms']                  = $this->symptoms($this->request->input('thyroid.symptoms'));
//        $map['thyroid.examination']               = $this->symptoms($this->request->input('thyroid.examination'));
//        $map['thyroid.hyperthyroidism']           = $this->symptoms($this->request->input('thyroid.hyperthyroidism'));
        $map['adrenal_gland.symptoms']            = $this->symptoms($this->request->input('adrenal_gland.symptoms'));
        $map['adrenal_gland.accompanied_symptom'] = $this->symptoms($this->request->input('adrenal_gland.accompanied_symptom'));

        return $map;
    }

    protected function symptoms($symptoms)
    {
        if (is_array($symptoms)) {
            return array_pad([], count($symptoms), 1);
        }

        return 1;
    }

    protected function getRootFieldsHasNoSon()
    {
        return [
            'id',
            'record_id',
            'diet',
            'sport',
            'normal',
            'remark'
        ];
    }

    protected function getRootFieldsHasSon()
    {
        return [];
    }

    protected function getSonFieldsForEachRoot()
    {
        return [];
    }
}